package github.fafaovo.common.guiblock;

import github.fafaovo.common.Itemgroup.ExampleGroup;
import github.fafaovo.common.block.ExampleMachineBlock;
import github.fafaovo.deepcapacity;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.function.Supplier;

public class GuiBlockInit {
    //方块注册
    public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, deepcapacity.MOD_ID);
    //物品注册
    public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, deepcapacity.MOD_ID);


    public static  RegistryObject<? extends Block> BlockRegistry(final String name, final Supplier<? extends Block> sup)
    {
        RegistryObject<? extends Block> TMP = BLOCKS.register(name,sup);
        RegistryObject<Item> TMP2 = ITEMS.register(name,()->new BlockItem(
                (Block) TMP.get(),new Item.Properties().group(ExampleGroup.exampleGroup)
        ));
        return TMP;
    }



    //注册的方块
    public static final RegistryObject<Block> EXAMPLE_BLOCK =
            (RegistryObject<Block>) BlockRegistry("machine_block", ExampleMachineBlock::new);


}
